#ifndef _308_H
#define _308_H

#include "main.h"
#include "driver/gpio.h"

extern uint8_t Delay_Time;
extern uint8_t PrintInkCount;
extern uint8_t PrintInkPluse;
extern uint8_t Test_Printdata;

/* 宏定义 --------------------------------------*/
#define CD4017_RESET_PIN        (7)
#define CD4017_CLR_L()      	GPIO.out_w1tc = ((uint32_t)1 << CD4017_RESET_PIN)//gpio_set_level(CD4017_RESET_PIN,0) //CD4017计数器的复位引脚
#define CD4017_CLR_H()      	GPIO.out_w1ts = ((uint32_t)1 << CD4017_RESET_PIN)//gpio_set_level(CD4017_RESET_PIN,1)

#define CD4017_CLK_PIN          (6)
#define CD4017_CLK_L()      	GPIO.out_w1tc = ((uint32_t)1 << CD4017_CLK_PIN)//gpio_set_level(CD4017_CLK_PIN,0)//CD4017时钟的复位键
#define CD4017_CLK_H()      	GPIO.out_w1ts = ((uint32_t)1 << CD4017_CLK_PIN)//gpio_set_level(CD4017_CLK_PIN,1)

#define HC595_OE_PIN            (12)
#define HC595_OE_L()      		GPIO.out_w1tc = ((uint32_t)1 << HC595_OE_PIN)//gpio_set_level(HC595_OE_PIN,0)  //HC595移位寄存器使能/禁止引脚
#define HC595_OE_H()      		GPIO.out_w1ts = ((uint32_t)1 << HC595_OE_PIN)//gpio_set_level(HC595_OE_PIN,1)

#define HC595_SLOAD_PIN         (13)
#define HC595_SLOAD_L()       	GPIO.out_w1tc = ((uint32_t)1 << HC595_SLOAD_PIN)//gpio_set_level(HC595_SLOAD_PIN,0)//HC595移位寄存器开启移位引脚
#define HC595_SLOAD_H()     	GPIO.out_w1ts = ((uint32_t)1 << HC595_SLOAD_PIN)//gpio_set_level(HC595_SLOAD_PIN,1)

#define HC595_SCLK_PIN          (14)
#define HC595_SCLK_L()     		GPIO.out_w1tc = ((uint32_t)1 << HC595_SCLK_PIN)//gpio_set_level(HC595_SCLK_PIN,0)//HC595移位寄存器开启存储引脚
#define HC595_SCLK_H()     		GPIO.out_w1ts = ((uint32_t)1 << HC595_SCLK_PIN)//gpio_set_level(HC595_SCLK_PIN,1)

#define HC595_SDO_PIN           (11)
#define HC595_SDO_L()       	GPIO.out_w1tc = ((uint32_t)1 << HC595_SDO_PIN)//gpio_set_level(HC595_SDO_PIN,0)	//HC595移位寄存器串行数据输入引脚
#define HC595_SDO_H()     		GPIO.out_w1ts = ((uint32_t)1 << HC595_SDO_PIN)//gpio_set_level(HC595_SDO_PIN,1)

#define InkPrtCnt  1
#define InkPrtPluse 2//2.0us

void delay_nus(uint32_t n);
void delay_1us(uint32_t n);
void DefDriverBoard_AddrReset(void);
void DefDriverBoard_AddrOutput(void);
void DefDriverBoard_Deserialize(uint32_t dat);
void DefDriverBoard_PowerOutput(uint32_t Pn);
void DefDriverBoard_HeatInk(uint32_t cycle,uint8_t Delay_Time);
void Print_TestData(void);
void Print_data(uint8_t *left_dot_data);
void Ink308_Initialize(void);

#endif
